/**
 * 
 */
package de.mmis.core.infrastructure;

import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.IOException;
import java.net.Socket;

class Client {
	protected Socket socket;
	protected BufferedInputStream input;
	protected BufferedOutputStream output;

	private String string;

	/**
	 * @throws IOException
	 *             when the streams could not be created
	 */
	public Client(Socket socket) throws IOException {
		this.socket = socket;
		input = new BufferedInputStream(socket.getInputStream());
		output = new BufferedOutputStream(socket.getOutputStream());
		string = toString();
	}

	@Override
	public String toString() {
		if (string != null)
			return string;
		return string = socket.toString();
	}

}